<?php 
/*
 * @Descripttion: 第三方开放接口路由列表
 * @version: v1
 * @Author: Terry
 * @Date: 2021-10-9 16:32:30
 * @LastEditors: Terry
 * @LastEditTime: 2024-12-12 15:08:26
 */

// ======================对外api====================

use think\facade\Route;

//正式版开放接口
Route::group('official/v1/', function () {
    //人脸对外接口
    Route::group('faceMachine/',function(){
        Route::post('getWorkerList', 'faceMachine/getWorkerList');//获取人员列表
        Route::post('uploadAttendance', 'faceMachine/uploadAttendance');//上传人员考勤
        Route::post('uploadWorker', 'faceMachine/uploadWorker');//上报人员数据
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
    
    //气体监测
    Route::group('gas/',function(){
        Route::post('uploadSensorDataList', 'gas/uploadSensorDataList');//上传数据
    })->middleware(['checkOpenApiData']);

    //前行云对接接口
    Route::group('machineCallBack/',function(){
        Route::post('checkIn', 'machineCallBack/checkIn');//人员考勤
        Route::post('faceHandle', 'machineCallBack/faceHandle');//控制设备增删查改
        Route::post('accept', 'machineCallBack/accept');//下发人员数据结果回调
    });

    //扬尘设备对外接口
    Route::group('dust/',function(){
        Route::group(function(){

            Route::post('upload', 'dust/upload');//扬尘数据上传
        })->middleware(['checkOpenApiToken']);

        Route::post('defaultUpload', 'dust/defaultUpload');//默认设备扬尘数据上传
    })->middleware(['checkOpenApiData']);
    // })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);

    //水表设备对外接口
    Route::group('water/',function(){
        Route::post('upload', 'water/upload');//水表数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);

    //电表设备对外接口
    Route::group('electric/',function(){
        Route::post('upload', 'electric/upload');//电表数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
    
     //塔吊设备对外接口
     Route::group('towerCrane/',function(){
        Route::post('upload', 'towerCrane/upload');//塔吊数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
    
    //升降机设备对外接口
     Route::group('elevator/',function(){
        Route::post('upload', 'elevator/upload');//升降机数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
    
    
    //塔吊post接口2
    Route::group('towerCraneTwo/',function(){
        Route::post('upload','towerCraneTwo/upload');
    })->middleware('checkData');
    
    
    //获取视频播放链接
    Route::group('video/',function(){
        Route::post('getUrl','video/getUrl');
        Route::post('getList','video/getList');
    })->middleware([
        'checkData',
        app\openApi\middleware\CheckToken::class,
        app\openApi\middleware\CheckData::class,app\openApi\middleware\Log::class
    ]);
    
    //aicam的钩子接口
    Route::group('aicamera/',function(){
        Route::post('alert','AICamera/alert'); //
        Route::post('speedCheck','AICamera/speedCheck'); //
    })->middleware([
        'checkOpenApiData',
    ]);

})->prefix('v1.');



//测试端路由api
Route::group('test/v1/', function () {
    //人脸对外接口
    Route::group('faceMachine/',function(){
        Route::post('getWorkerList', 'faceMachine/getWorkerList');//获取人员列表
        Route::post('uploadAttendance', 'faceMachine/uploadAttendance');//上传人员考勤
        Route::post('uploadWorker', 'faceMachine/uploadWorker');//上报人员数据
        
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
    
    //扬尘设备对外接口
    Route::group('dust/',function(){
        Route::post('upload', 'dust/upload');//扬尘数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);

    //水表设备对外接口
    Route::group('water/',function(){
        Route::post('upload', 'water/upload');//水表数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
    
    //电表设备对外接口
    Route::group('electric/',function(){
        Route::post('upload', 'electric/upload');//电表数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);

    //塔吊设备对外接口
    Route::group('towerCrane/',function(){
        Route::post('upload', 'towerCrane/upload');//塔吊数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);

    //塔吊post接口2
    Route::group('towerCraneTwo/',function(){
        Route::post('upload','towerCraneTwo/upload');
    })->middleware('checkData');

    //升降机设备对外接口
    Route::group('elevator/',function(){
        Route::post('upload', 'elevator/upload');//升降机数据上传
    })->middleware([ app\openApi\middleware\CheckToken::class, app\openApi\middleware\CheckData::class,'dataEncryption']);
})->prefix('v1.');

